package com.naiterui.ehp.bs.patient.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.naiterui.ehp.bp.domain.ConsultBill;
import com.naiterui.ehp.bs.patient.dao.IConsultBillDao;
import com.naiterui.ehp.bs.patient.repository.IApConsultBillRepository;
import com.naiterui.ehp.bs.patient.service.IConsultBillService;

/**
 * 问诊账单业务接口实现
 *
 * @author Amber
 * @since 1.0.0
 */
@Service
public class ApConsultBillServiceImpl implements IConsultBillService {

    @Autowired
    private IApConsultBillRepository consultBillRepository;

    @Override
    @Transactional(rollbackFor = Exception.class, readOnly = true)
    public Map<Long, ConsultBill> getConsultBillPayStatus(List<Long> billIds) {
        Map<Long, ConsultBill> result = new HashMap<>();
        List<ConsultBill> bills = this.consultBillRepository.findByIdIn(billIds);

        for (ConsultBill bill : bills) {
            result.put(bill.getId(), bill);
        }
        return result;
    }

}
